package com.yunfeisoft.business.service.impl;

import com.applet.base.BaseServiceImpl;
import com.applet.sql.separation.DataSourceChange;
import com.applet.utils.Page;
import com.yunfeisoft.business.dao.inter.CmsTopicCategoryDao;
import com.yunfeisoft.business.model.CmsTopicCategory;
import com.yunfeisoft.business.service.inter.CmsTopicCategoryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ClassName: CmsTopicCategoryServiceImpl
 * Description: 话题分类表service实现
 * Author: Jackie liu
 * Date: 2020-06-02
 */
@Service("cmsTopicCategoryService")
public class CmsTopicCategoryServiceImpl extends BaseServiceImpl<CmsTopicCategory, String, CmsTopicCategoryDao> implements CmsTopicCategoryService {

    @Override
    @DataSourceChange(slave = true)
    public Page<CmsTopicCategory> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public int modifyShowStatus(String id, int showStatus) {
        if (StringUtils.isBlank(id)) {
            return 0;
        }

        CmsTopicCategory category = new CmsTopicCategory();
        category.setId(id);
        category.setShowStatus(showStatus);

        return getDao().update(category);
    }
}